# ZOE - what's going on here? something we can delete?
The Olney transit corridor runs along ordered_stop_dat$on_street %>% unique() %>% create_route_sentence() between first(ordered_stop_dat$at_street) and last(ordered_stop_dat$at_street). The corridor serves the routes create_route_sentence(unique(stop_route_analytics$route_id)). There are length(subcorridors[[3]][[1]]) total bus stops along the corridor, with the average bus trip running past round(mean(subcorridors_dat[[4]][[1]]$n_stops)) stops spanning round(mean(subcorridors_dat[[4]][[1]]$distance_traveled),digits=2) miles.
# map of routes that exist in this corridor
leaflet() %>%
setView(lng = -75.14511, lat = 40.03905, zoom = 13) %>%
addProviderTiles(providers$Stamen.Toner) %>%
addCircleMarkers(daily_stop_analytics, lat = daily_stop_analytics$stop_lat, lng = daily_stop_analytics$stop_lon, radius = (daily_stop_analytics$total_ons + daily_stop_analytics$total_offs)/100, color = "blue")
#addPolylines(data = routes_w_ridership, color = "#4377bc", weight = 4, layerId = link_stop_data$fromto, opacity = 0.5)
# also add chart/table of global averages for context of subcorridors
These charts illustrate characteristics for the Olney corridor as a whole, such as average speed and ridership. Average speed, as well as ridership., vary both by route and by time of day.
table_1 <- full_corridor_results$route_analytics[[1]] %>% bind_rows(full_corridor_results$analytics[[1]] %>% mutate(route_id = "Total"))
kable(table_1, booktabs = TRUE, align = 'c',format.args = list(big.mark = ","),digits=1) %>%
kable_styling(latex_options = "scale_down") %>%
row_spec(dim(table_1)[1], bold = T) %>% # format last row
column_spec(1, italic = T) %>% # format first column
scroll_box(width = "100%", height = "300px")
| route_id | daily_ridership | trips | routes_served | service_hours | riders_per_hour | on_off | dwell_observed_mean | dwell_predicted_mean | dwell_hybrid_mean | dwell_per_onoff | onoff_per_trip | onoff_per_tripstop | avg_segment_speed | avg_speed_10_pct | avg_speed_25_pct | avg_speed_75_pct | avg_speed_90_pct |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 18 | 6,826 | 235 | 18 | 19.8 | 345.1 | 3,896.5 | 0 | 83.7 | 83.7 | 0.2 | 16.6 | 1.5 | 12.0 | 9.6 | 10.3 | 12.6 | 14.5 |
| 26 | 4,966 | 227 | 26 | 20.1 | 247.4 | 2,072.4 | 0 | 71.0 | 71.0 | 0.1 | 9.1 | 0.9 | 11.1 | 9.6 | 10.3 | 11.9 | 13.2 |
| Total | 11,792 | 462 | 18, 26 | 39.9 | 295.9 | 5,968.9 | 0 | 77.5 | 77.5 | 0.2 | 12.9 | 1.2 | 11.6 | 9.6 | 10.3 | 12.1 | 14.0 |
# ggplot(route_analytics, aes(x = route_id, y = avg_segment_speed)) +
# geom_bar(stat = "identity", fill="skyblue", alpha=0.7) +
# geom_errorbar(data = route_analytics, stat = "identity", ymin = route_analytics$avg_speed_10_pct, ymax = route_analytics$avg_speed_90_pct, colour="orange", alpha=0.6, size=1.3, width = 0.4) +
# scale_y_continuous(name = "Speed (MPH) - Includes Dwell Time", n.breaks = 8, limits = c(0, max(route_analytics$avg_speed_90_pct) * 1.1)) +
# scale_x_discrete(name = "Route Number") +
# labs(title = paste0("The Average Bus Travels at ", round(mean(analytics$avg_segment_speed), 1), " MPH on the Corridor")) +
# theme(text = element_text(size = 9))
#will have to change the Olney plots to work with the new function structure
plot_hourly_speed(full_corridor_results$hourly_analytics[[1]], "Olney Avenue")
plot_speed_by_period(full_corridor_results$binned_analytics[[1]], "Olney Avenue")
plot_ridership_by_period(full_corridor_results$binned_analytics[[1]], "Olney Avenue")
Here, we separate overall corridor statistics by route to better understand the makeup of Olney bus traffic. The first three graphs, which cover ridership (both average daily ridership and average ridership per hour), the number of trips, and number of service hours per route, aggregate for both directions of each route. Next, average hourly ridership is again shown, but divided by whether the bus was Eastbound or Westbound (as Olney runs E-W). Average corridor running time, or the time it takes for a bus to make one trip along the corridor, and average hourly speed are also differentiated by direction.
# plot_daily_ridership_trips(subcorridors_dat,"OL")
#
# plot_service_hrs(subcorridors_dat,"OL")
#
# plot_ridership_by_route(subcorridors_dat, "OL")
#
# plot_ridership_by_route_dir(subcorridors_dat, "OL")
#
# plot_running_time(subcorridors_dat, "OL")
#
# plot_speed_by_route_dir(subcorridors_dat, "OL")
Note: average speed and running time are calculated for the entire running time, including dwell times.
There are three main “sub-corridors” within the Olney corridor: Chelten to Broad, which is the section west of Broad St, Broad to 7th, and 7th to Front, which are both east of Broad St.
#stop_cb <- c("SEPTA372","SEPTA15911","SEPTA15794", "SEPTA15912", "SEPTA15789", "SEPTA15915", "SEPTA15586", "SEPTA15793", "SEPTA15913","SEPTA15791", "SEPTA15914", "SEPTA15792", "SEPTA15786", "SEPTA15916", "SEPTA15782", "SEPTA15917", "SEPTA15587", "SEPTA16979", "SEPTA15779", "SEPTA15918", "SEPTA15919")
subcorridors_results$daily_ridership_trips_plot[[1]]
## TableGrob (1 x 2) "arrange": 2 grobs
## z cells name grob
## 1 1 (1-1,1-1) arrange gtable[layout]
## 2 2 (1-1,2-2) arrange gtable[layout]
subcorridors_results$hourly_speed_plot[[1]]
subcorridors_results$speed_by_route_dir_plot[[1]]
# stop_b7 <- c("SEPTA15796", "SEPTA15908", "SEPTA15798", "SEPTA15907", "SEPTA15799", "SEPTA15800", "SEPTA16966", "SEPTA15814", "SEPTA16965", "SEPTA381", "SEPTA15795", "SEPTA373", "SEPTA15910")
subcorridors_results$daily_ridership_trips_plot[[2]]
## TableGrob (1 x 2) "arrange": 2 grobs
## z cells name grob
## 1 1 (1-1,1-1) arrange gtable[layout]
## 2 2 (1-1,2-2) arrange gtable[layout]
subcorridors_results$hourly_speed_plot[[2]]
subcorridors_results$speed_by_route_dir_plot[[2]]
#stop_7f <- c("SEPTA16963", "SEPTA15815", "SEPTA16964", "SEPTA15817","SEPTA15819", "SEPTA16961", "SEPTA32312", "SEPTA16960", "SEPTA15820", "SEPTA16959", "SEPTA15822", "SEPTA15697", "SEPTA15899", "SEPTA15818", "SEPTA16962")
subcorridors_results$daily_ridership_trips_plot[[3]]
## TableGrob (1 x 2) "arrange": 2 grobs
## z cells name grob
## 1 1 (1-1,1-1) arrange gtable[layout]
## 2 2 (1-1,2-2) arrange gtable[layout]
subcorridors_results$hourly_speed_plot[[3]]
subcorridors_results$speed_by_route_dir_plot[[3]]